package cn.xgj.sfzy.controller;

import cn.xgj.sfzy.entity.Company;
import cn.xgj.sfzy.service.CompanyService;
import cn.xgj.sfzy.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName CompanyController
 * @Description TODO
 * @Author gcc
 * @Date 2024年10月23日 20:44
 * @Version 1.0
 */
@RestController
@RequestMapping("/company")
public class CompanyController {
    @Autowired
    private CompanyService companyService;

    //    查询
    @PostMapping("/select")
    public Result select() {
        Company company = companyService.select();
        return Result.success(company);
    }

    //    修改
    @PutMapping
    public Result eidt(@RequestBody Company company) {
        int num = companyService.edit(company);
        if (num != 0) {
            return Result.success("修改成功");
        } else {
            return Result.error("修改失败");
        }
    }
}
